

import java.io.IOException;
//import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dao.EnvioCorreoDAO;

/**
 * Servlet implementation class enviar
 */
@WebServlet("/enviar")
public class enviar extends HttpServlet {
	private static final long serialVersionUID = 1L;
	String nombreIng;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public enviar() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		//PrintWriter out = response.getWriter();
		nombreIng= request.getParameter("correo");  
		//out.println("nombre ingresado por Servlet2 : " +nombreIng);
		try {
			if (nombreIng.equals("protesto")){
				EnvioCorreoDAO form2 = new EnvioCorreoDAO();
				form2.setProtesto();
			}
			else if (nombreIng.equals("ticket")){
				EnvioCorreoDAO form2 = new EnvioCorreoDAO();
				form2.setTicket();
			}
			else if (nombreIng.equals("stock0")){
				EnvioCorreoDAO form2 = new EnvioCorreoDAO();
				form2.setStock0();
			}else{
				System.out.println("propiedad '"+nombreIng+"' no programado en e-avizor");
			}
				
				
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
